###out:src/main/java/${config.basePackageName?replace(".","/")}/${config.modulePackageName?replace(".","/")}/${config.mapperXMLDirectoryName?replace(".","/")}/${root.beanName}Dao.xml
<#macro mapperEl value>${r"#{"}${value}}</#macro>
<#macro jspEl value>${r"${"}${value}}</#macro>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${config.basePackageName}.${config.modulePackageName}.${config.daoPackageName}.${root.beanName}Dao">
    
    
	<insert id="insert">
	INSERT INTO ${root.tableName}(
		<#list root.tableColumns as column>${column.columnName}<#if column_has_next>,</#if></#list>
		) VALUES (
			<#list root.tableColumns as column><@mapperEl column.propertyName/><#if column_has_next>,</#if></#list>
		)
	</insert>
	
		<!-- 修改  -->
	<update id="update">
		UPDATE ${root.tableName} SET	
		    id = <@mapperEl 'id'/>
		     <#list root.tableColumns as column>
		    <#if column.columnName != 'id' >
		   
		     <if test="${column.propertyName} != null">
		    	,${column.propertyName} =<@mapperEl column.propertyName/>
		    </if>	  
		    </#if>
		      </#list> 
		    
	     WHERE id = <@mapperEl 'id'/>	
	</update>
	
	
		<!-- 通过id获取唯一记录  -->
	<select id="findByEntity" resultType="${config.basePackageName}.${config.modulePackageName}.${config.entityPackageName}.${root.beanName}" parameterType="${config.basePackageName}.${config.modulePackageName}.${config.entityPackageName}.${root.beanName}">
		SELECT 
		*
		FROM 
			${root.tableName} a		
		<where>
			a.delflag = 0
			<if test="id != null and id != ''">
				AND a.id = <@mapperEl 'id'/>
			</if>
		</where>
	</select>


	<select id="findList" resultType="${config.basePackageName}.${config.modulePackageName}.${config.entityPackageName}.${root.beanName}" parameterType="${config.basePackageName}.${config.modulePackageName}.${config.entityPackageName}.${root.beanName}">
	SELECT 
			* 
		FROM ${root.tableName} a
		<where>
			a.delflag = '0'
			<if test="createby != null and createby != ''">
		    	AND a.createby = <@mapperEl 'createby'/>
		    </if>
		    <choose>
				<when test="page !=null and page.orderBy != null and page.orderBy != ''">
					ORDER BY <@jspEl 'page.orderBy'/>
				</when>
				<otherwise>
					ORDER BY a.createdate DESC
				</otherwise>
			</choose>
		</where>
	
	</select>
	
	<update id="deleteByLogic">
	UPDATE ${root.tableName} SET delflag = '1' WHERE id = <@mapperEl 'id'/>
	</update>
</mapper>
